// t215 涉及第k个最大元素 考虑选择使用最小堆

const Minheap = require('./MinHeap')

var findKthLargest = function(nums, k) {
  const h = new Minheap()
  nums.forEach(num => {
      h.insert(num)
      h.size() > k && h.pop()
  })
  return h.peek()
};